package com.novax.ex.activity.infrastructure.mapper;

import com.novax.ex.activity.infrastructure.entity.MallOrderWinner;
import com.novax.ex.common.base.BaseEntity;
import com.novax.ex.common.base.BaseMapper;
import com.novax.ex.common.util.PageUtil;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * @Description
 * @Author zhaolei
 * @Date 3/28/23 7:52 PM
 * @Version 1.0
 */
public interface MallOrderWinnerMapper extends BaseMapper {

    List<MallOrderWinner> selectMsg();

    List<MallOrderWinner> selectDetailMsg(Long productId);

    /**
     * Description: 商品销售报表-统计
     *
     * @return java.lang.Long
     * @author Deucalion@novax.email
     * @date 2023/2/23 10:24
     */
    Long salesCount(PageUtil pageInfo);

    /**
     * Description: 商品销售报表-分页
     *
     * @return java.util.List<T>
     * @author Deucalion@novax.email
     * @date 2023/2/23 10:25
     */
    <T extends BaseEntity> List<T> salesPage(PageUtil pageInfo);

    /**
     * Description: 商品获得明细-统计
     *
     * @return java.lang.Long
     * @author Deucalion@novax.email
     * @date 2023/2/23 10:24
     */
    Long itemCount(PageUtil pageInfo);

    /**
     * Description: 商品获得明细-分页
     *
     * @return java.util.List<T>
     * @author Deucalion@novax.email
     * @date 2023/2/23 10:25
     */
    <T extends BaseEntity> List<T> itemPage(PageUtil pageInfo);

    /**
     * @description: 获取尚未沟通-待领取的中奖信息-最新记录
     * @author: Wade
     * @date: 3/7/23 11:19 AM
     * @param: [userId]
     * @return: com.novax.ex.activity.infrastructure.entity.MallOrderWinner
     **/
    MallOrderWinner unclaimed(@Param("userId") Long userId);

    /**
     * @description: 查询往期记录数
     * @author: Wade
     * @date: 3/16/23 3:28 PM
     * @param: [pageInfo]
     * @return: java.lang.Long
     **/
    Long winnersCount(PageUtil pageInfo);

    /**
     * @description: 查询往期记录分页数据
     * @author: Wade
     * @date: 3/16/23 3:28 PM
     * @param: [pageInfo]
     * @return: java.util.List<T>
     **/
    <T extends BaseEntity> List<T> winnersPage(PageUtil pageInfo);

    /**
     * @description: 获取最新的已发放记录
     * @author: Wade
     * @date: 3/29/23 11:53 AM
     * @param: [userId]
     * @return: com.novax.ex.activity.infrastructure.entity.MallOrderWinner
     **/
    MallOrderWinner getWinnerNew(@Param("userId") Long userId);

    /**
     * @description: 设置最新的状态为已读
     * @author: Wade
     * @date: 3/29/23 11:54 AM
     * @param: [id]
     * @return: com.novax.ex.activity.infrastructure.entity.MallOrderWinner
     **/
    void setWinnerNewTag(@Param("id") Long id);

    /**
     * Description: 获取修改前旧数据列表
     *
     * @return java.util.List<com.novax.ex.activity.infrastructure.entity.MallOrderWinner>
     * @author Deucalion@novax.email
     * @date 2023/4/3 8:25
     */
    List<MallOrderWinner> selectOldData(@Param("ids") Set<String> ids);

    /**
     * Description: 批量状态变更,状态改为2、3
     *
     * @return int
     * @author Deucalion@novax.email
     * @date 2023/4/3 9:11
     */
    int batchStatusChangeGive(@Param("list") List<MallOrderWinner> list);

    /**
     * Description: 批量状态变更,状态改为4
     *
     * @return int
     * @author Deucalion@novax.email
     * @date 2023/4/3 9:11
     */
    int batchStatusChangeEnd(@Param("list") List<MallOrderWinner> list);
}
